﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace Mindfor.Error
{
	/// <summary>
	/// Represents data about exceptions that submits to server.
	/// </summary>
	[Serializable]
	[XmlRoot("errorData")]
	[XmlInclude(typeof(ExceptionInfo))]
	public class ErrorData
	{
		/// <summary>
		/// Gets or sets unique application id.
		/// </summary>
		[XmlElement("applicationId")]
		public Guid ApplicationId { get; set; }

		/// <summary>
		/// Gets or sets application version.
		/// </summary>
		public string ApplicationVersion { get; set; }

		/// <summary>
		/// Gets or sets info about application exception and it's inner exceptions.
		/// </summary>
		[XmlElement("exception")]
		public List<ExceptionInfo> Exceptions { get; set; }

		/// <summary>
		/// Initializes new instance.
		/// </summary>
		public ErrorData()
		{
			Exceptions = new List<ExceptionInfo>();
		}

		/// <summary>
		/// Initializes new instance with application id.
		/// </summary>
		/// <param name="applicationId">Unique application id.</param>
		public ErrorData(Guid applicationId)
			: this()
		{
			ApplicationId = applicationId;
		}
	}
}
